<%@page import="com.winexpress.support.Enquiry"%>
<%@page import="java.util.List"%>
<%@page import="com.winexpress.util.SessionAttributes"%>
<%@taglib prefix="t" tagdir="/WEB-INF/tags" %>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>wineXpress online shop</title>  
    </head>
    <body>
        <t:adminNavigation/>
        <% if (session.getAttribute(SessionAttributes.USER_ID) == null) {%>        
        <jsp:forward page="/loginFail.jsp" />
        <% }%>
        <h2><center>Pending Enquiries List</center></h2>  <br/>   
    <center><table id="example" class="table table-bordered" style=' width:60%;   ' >
            <thead>
                <tr>
                    <th>Enquiry ID</th>
                    <th>Customer ID</th>
                    <th>Category </th>
                    <th>Subject </th>                    
                    <th></th>                      
                </tr>
            </thead>
            <tbody>
                <%  List<Enquiry> list = (List) request.getAttribute("EnquiryList");%>
                <% if (!list.isEmpty()) {
                        for (Object o : list) {
                            Enquiry c = (Enquiry) o;%>
                <tr style="vertical-align: central;">
                    <td style="vertical-align: middle;"> <%=c.getId()%> </td>
                    <td style="vertical-align: middle;"><%=c.getCustomer().getId()%></td>
                    <td style="vertical-align: middle;"> <%=c.getCategory()%> </td>
                    <td style="vertical-align: middle;"> <%=c.getSubject()%> </td>
                    <td style="vertical-align: middle;"> 
                        <form class="form-horizontal" role="form" id="viewEnquiry"  name="viewEnquiry" action="/WineXpressClient/enquiryManagement/viewPendingEnquiry" method="post"> 
                            <center><button type="submit" class="btn btn-default" >View</button></center>
                            <input name="viewID" id="viewID" type="hidden" value="<%=c.getId()%>"/>
                        </form> </td>
                </tr>   
                <%}
                } else {%>
                <tr>No more pending enquiry.</tr>
                <%}%>
            </tbody>
        </table>
        <script type="text/javascript">
            $(document).ready(function() {
                $('#example').dataTable({
                    "aaSorting": [[4, "desc"]]
                });
            });</script>
    </center>
                <t:footer/>
</body>
</html>
